<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/3 0003
 * Time: 13:26
 */

namespace Common\Model;


class ShOrderModel extends AiModel
{

    public function addPayLog($data)
    {
        $data['add_time'] = ADD_TIME;
        $data['add_ip'] = ADD_IP;

        $mod = M('ShOrder');

        $order_id = $mod->add($data);
        $pay_log_id = D('PayLog')->addPayLog(3, '', $pay_type = 'sh_product', $data['price'], $data['user_id']);
        $mod->where('id=' . $order_id)->data(array('pay_log_id' => $pay_log_id))->save();
        return array('order_id' => $order_id, 'pay_log_id' => $pay_log_id);
    }

    public function getPayState($pay_log_id)
    {
        $pay_time = M('ShOrder')->where(array('pay_log_id' => $pay_log_id))->getField('pay_time');
        return $pay_time;
    }

}